package com.gzz.orchid.context.infrastructure.support.serial;

import com.gzz.orchid.common.core.support.SerialNoGenerator;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * 账户顺序号生成器
 *
 * @author higmd
 */
public class AccountSerialNoGenerator extends SerialNoGenerator {

    public AccountSerialNoGenerator(RedisTemplate<String, Object> redisTemplate) {
        super(redisTemplate);
    }

    /**
     * 账户编号(10位)
     *
     * @return
     */
    public String buildSerialNo() {
        return String.format("AC%8s", this.getNextSerialId("SN-ACCOUNT"))
                .replace(" ", "0");
    }
}